import React from "react";

export class InputGroup extends React.PureComponent<any, any>{
    constructor(props) {
        super(props)
    }
    render() {
        let { name, value, valueSetter, prepend, icon, placeholder, type = 'default' } = this.props;
        return <div className="input-group mb-1 mt-1">
            <span className="input-group-text st-group-text">{icon ? <span className={`fas fa-${icon}`} aria-hidden="true"></span> : prepend}</span>
            {type === 'default' && <input type="text" className="form-control" name={name} onChange={valueSetter} value={value} placeholder={placeholder}></input>}
            {type === 'textarea' && <textarea aria-label="With textarea" className="form-control" name={name} onChange={valueSetter} value={value} placeholder={placeholder}></textarea>}
        </div>
    }
}